\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

SPRITE ANIMATION/MOLDING: CLOAKER


STEP 1: calculate object pointer address of monster
[(monster byte) x 4] + $250400 = object pointer address
[($DD) x 4] + $250400 = $250774

//////////////////////////////////////////////////////////////

MOLDING

STEP 2: calculate mold pointer address
[(byte 3,4) x 3] + $252000 = mold pointer address
[$005C x 3] + $252000 = $252114
STEP 3: determine mold/sequence data addresses from mold pointer
mold pointer + 2 = mold data
$26CF6E(PC address) + 2 = $26CF70
STEP 4: determine mold set pointer address from byte 3,4
(byte 3,4) + mold pointer = mold set pointer address
$005F + $26CF6E = $26CFCD
STEP 5: determine mold function address from byte
Cloaker has 17 mold assignments (2 bytes each), as seen in the selection.

[(byte 1,2) AND $0FFF] + mold pointer = sprite GFX mold
[$0083 AND $0FFF] + $26CF6E = $25CFF1

bit 7 of byte 2 (00) is not set, so it uses a dynamic mold format
STEP 6: arrange 8x8 tiles into full sprite through function
byte 1 = tile format
80 = [1 -]
.....[- -]
byte 2 = Y coordinate (0x10)
byte 3 = X coordinate (0x13)
byte 4 = 8x8 tile pointer (0x15)

00 = END DATA

Cloaker's mold data for all molds runs to $26D336

Here are the 10 types of 16x16 tile formats. The orange 8x8 tiles are numbered in the order that they are read from the ROM. The green 8x8 tiles are transparent.


60

70

80

90

A0

B0

C0

D0

E0

F0

Tile function _2

Instead of the 10 types of tile formats described above, the byte value could be _2.
This function is used to load 1 to 15 16x16 tiles that has or have already been identified.
Any value from 0 to 15 (0 to F) could be in _, where that value is the number of tiles to use again.

EXAMPLE: OCTOLOT

This is Octolot's mold data.
This is a _2 function used to "duplicate" a tile.
  • Since it is 12, it will only read one tile.
  • The 0xEB and 0xEE are the Y and X coordinate values to add to the original Y and X coordinate values.
  • The 0x00C4 is to be added to the mold pointer (0x26EBC5 in this case for Octolot, like 0x26CF6E for Goomba).
Add the short to the mold pointer...
  • 0x26EBC5 + 0x00C4 = 0x26EC89
  • A0 F4 04 0C 13 will be used once more, except with different coordinates.
  • The original coordinates were F4 and 04
  • The new coordinates will be F4 + EB = DF (the sum must be ONLY 1 byte) and 04 + EE = F2.
  • Therefore the new Y and X coords will be DF and F2.
So concluding from this, there are two 16x16 tiles that are the same, but at different coordinates.
If the function were 22 instead of 12, then it would also read the next 16x16 tile which is F0 FA F3 20 15 25 26 tile and add the coordinates to that one also. (FA + EB and F3 + EE).
In the ROM, only 12 and 22 are ever used, but when editing it yourself, any value from 0 to 15 is possible.




These are the 16x16 tiles.
The bright green represents the completely transparent area, so as to allow overlap (explained later). The function byte, byte 1, tells what 8x8 tiles are to be transparent. See doc_sprite-gfx.txt for details.
80 10 13 15
C0 10 03 13 14
A0 00 13 03 0B
F0 00 03 01 02 09 0A

Here is the arrangement of the 16x16 tiles into the shield. The individual coordinates of each 16x16 tile allows them to be freely arranged anywhere on the object plane (which spans about 80% of the entire screen). Only preceding tiles can always overlap each other (ie. 16x16 tiles always and only overlap ones after them in the data block at $26CFF1).

Overlaps are used for practical reasons, such as Cloaker's shield being the first in the data block. It is in front of his body and overlaps all.

The coordinates of the bottom-right portion of the shield are 19 by 16, or the corresponding hex values 0x10 and 0x13, respectively. The bottom-left portion is just 3 pixels to the right of the dead center of the object plane and 16 pixels down from it, etc. etc...
(left) Here is a piecing together of the Cloaker sprite in the sequential order of all 22 tiles.

(right) This is the complete span of the object's maximum coordinates, 256 x 256.
The upper-left and upper-right quadrants are for negative Y coordinates which use values 0x80 and above.
The upper-left and lower-left quadrants are for negative X coordinates which use values 0x80 and above.

The point where the lines cross is the dead center: here the shield can be approximated at about 0,0. The exact coordinates of the shield are 3,0.

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

ANIMATION

Cloaker uses 5 animation sequences

STEP 2: calculate mold pointer address
[(byte 3,4) x 3] + $252000 = mold pointer address
[$005C x 3] + $252000 = $252114
STEP 3: determine mold/sequence data addresses from mold pointer
mold pointer + 2 = mold data
$26CF6E(PC address) + 2 = $26CF70
STEP 4: determine animation sequence address from byte 1,2
(byte 1,2) + mold pointer = animation sequence pointers address
$000C + $26CF6E = $26CF7A
STEP 5: determine sequence data address from byte
Cloaker has 5 sequence assignments (2 bytes each), as seen in the selection

(byte 1,2) + mold pointer = sequence data
$0018 + $26CF6E = $26CF86
STEP 6: sequence data


(mold byte x 2) + $26CFCD = tile-shifting data pointer
($0F x 2) + $26CFCD = $26CFEB


$038B + $26CF6E = $26D2F9
every 2 bytes is a frame
byte 1 = frame delay
byte 2 = sprite mold to use for frame

06 = delay 6 frames
00 = use mold 1
08 = delay 8 frames
0F = use mold 16
06 = delay 6 frames
00 = use mold 1
08 = delay 8 frames
10 = use mold 17
00 = END SEQUENCE
STEP 7: tile shifting animation mold

42 = upper bits: move 4 tiles together (lower bits: shift function)
FF 00 = Y shift, X shift (FF = up 1 pixel, 00 = no X shift)
83 00 = pointer: modify tiles at 0x83 bytes after $26CF6E ***

22 = upper bits: move 2 tiles together
00 00 = Y shift, X shift
98 00 = pointer

etc...
00 = END DATA

*** the ENTIRE mold for the frame (the whole sprite) must be set, which is the reason for some of the 0,0 shifts. These aren't modified, but they still must be identified or they will not appear.

ANIMATION (more...)

Cloaker's 4th animation sequence

choose frame
The frame which uses the mold that modifies the eyebrows along with other body parts is at $26CFA3: 04 07.

04 is the frame delay, and 07 is the mold.
find pointer to mold address
($07 x 2) + $26CFCD = $26CFDB
$01EE + $26CF6E = $26D15C
find tiles for eyebrows
42
04 FC
83 00 = the shield

12
03 FD
98 00 = the arm holding the shield

12
01 00
9E 00 = the feather

12
07 F9
37 01 = top left corner of mustache and eyebrow

12
FE 01
A4 00 = bottom right corner of mustache

22
07 F9
40 01 = most of mustache and eyebrows

22
02 FE
B9 00 = the beard

62
00 00 = no shift!
C5 00 = the body and hat

42
FA 06
EC 00 = the arm holding the sword

00

The eyebrows are modified at $26D176.
22 = move 2 tiles together
07 F9 = Y shift, X shift
40 01 = pointer

$0140 + $26CF6E = $26D0AE
The two selections are the two tiles used. Parts of these tiles were not used in the previous frames: the streched eyebrows are new.

However, any tiles can be used, new or old. The animation in step 3 reloads the entire mold in pieces so that each piece can be modified or not modified separately.



This type of animation is a kind of 'piecing' animation which takes groups of 16x16 tiles that can be considered a 'piece' (like the whole shield, which is four 16x16 tiles) and moves it as one.

This gives the objects a puppet-like orientation of segmented joints and appendages.